Add support for --header flags in MCP Inspector CLI#716
Merged
olaservo merged 6 commits intoAug 29, 2025
Conversation
- Add --header option to both wrapper CLI (cli.ts) and main CLI (index.ts) - Support multiple headers with "HeaderName: Value" format validation - Pass headers to HTTP and SSE transports via requestInit.headers - Add parseHeaderPair function for proper header parsing - Fix output truncation issue by removing forced process.exit(0) - Update types to include headers in Args and TransportOptions Usage: --header "Authorization: Bearer token" --header "X-Custom: value"
67f7674 to
a2111af
Compare
- Document --header flag usage with examples - Explain header format requirements - Clarify transport support (HTTP, SSE, not STDIO) - Add authentication examples with API keys and bearer tokens
a2111af to
d7927ec
Compare
olaservo
reviewed
Aug 29, 2025
| process.exit(0); | ||
|
|
||
| // Let Node.js naturally exit instead of force-exiting | ||
| // process.exit(0) was causing stdout truncation |
Member
There was a problem hiding this comment.
Originally I think this was added because it was hanging on CI, however I am not seeing that behavior in the pipeline here when the tests run.
Looking at the past commits where the process.exit(0) was added, this was the test failure that happened: https://github.com/modelcontextprotocol/inspector/actions/runs/16283307379/job/45977026872
Which doesn't happen anymore, so it may not have been needed in the first place? But we should keep an eye out for anything that might be intermittent.
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #420
Summary
Adds support for (multiple)
--headerflags to the MCP Inspector CLI, enabling custom HTTP headers for authentication and other purposes.Changes
--headeroption to both wrapper CLI and main CLI with "HeaderName: Value" format validationrequestInit.headersprocess.exit(0)Usage
Testing
Example Use Case
This enables authentication with MCP servers that require API keys or other custom headers: